import request from "@/utils/request.js";

const api_prefix = "/address";

export function save(data) {
  return request({
    //模板字符串拼接参数
    url: `${api_prefix}/save`,
    method: "POST",
    data: data,
  });
}

export function update(data) {
  return request({
    //模板字符串拼接参数
    url: `${api_prefix}/update`,
    method: "POST",
    data: data,
  });
}

export function list(userId) {
  return request({
    //模板字符串拼接参数
    url: `${api_prefix}/list/${userId}`,
    method: "GET",
  });
}

export function getById(addressId) {
  return request({
    //模板字符串拼接参数
    url: `${api_prefix}/list/id/${addressId}`,
    method: "GET",
  });
}

export function getAreaData() {
  return request({
    //模板字符串拼接参数
    url: `${api_prefix}/area/list`,
    method: "GET",
  });
}

export function remove(id) {
  return request({
    //模板字符串拼接参数
    url: `${api_prefix}/remove/${id}`,
    method: "DELETE"
  });
}

export function echo(id) {
  return request({
    //模板字符串拼接参数
    url: `${api_prefix}/echo/${id}`,
    method: "GET",
  });
}
